/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "tarifa")
@NamedQueries({
    @NamedQuery(name = "Tarifa.findAll", query = "SELECT t FROM Tarifa t")})
public class Tarifa implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected TarifaPK tarifaPK;
    @JoinColumn(name = "tipo_habitacion", referencedColumnName = "id_tipo", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private TipoHabitacion tipoHabitacion1;

    public Tarifa() {
    }

    public Tarifa(TarifaPK tarifaPK) {
        this.tarifaPK = tarifaPK;
    }

    public Tarifa(Date desde, Date hasta, BigDecimal precio, int tipoHabitacion) {
        this.tarifaPK = new TarifaPK(desde, hasta, precio, tipoHabitacion);
    }

    public TarifaPK getTarifaPK() {
        return tarifaPK;
    }

    public void setTarifaPK(TarifaPK tarifaPK) {
        this.tarifaPK = tarifaPK;
    }

    public TipoHabitacion getTipoHabitacion1() {
        return tipoHabitacion1;
    }

    public void setTipoHabitacion1(TipoHabitacion tipoHabitacion1) {
        this.tipoHabitacion1 = tipoHabitacion1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tarifaPK != null ? tarifaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tarifa)) {
            return false;
        }
        Tarifa other = (Tarifa) object;
        if ((this.tarifaPK == null && other.tarifaPK != null) || (this.tarifaPK != null && !this.tarifaPK.equals(other.tarifaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Tarifa[ tarifaPK=" + tarifaPK + " ]";
    }
    
}
